package com.hbpu.maven.spring.ioc.bean;


import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.Data;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

@Data
public class User implements InitializingBean, DisposableBean {
    private String name;
    private String password;

    public void initUser() {
        System.out.println("initUser");
    }

    public void destroyUser() {
        System.out.println("destroyUser");
    }

    @PostConstruct
    public void postConstruct() {
        System.out.println("postConstruct");
    }

    @PreDestroy
    public void preDestroy() {
        System.out.println("preDestroy");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("销毁：destroy");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("属性注入之后：afterPropertiesSet");
    }
}
